package org.dant.ant.extension.net;

import java.io.File;
import java.net.URL;

import org.dant.ant.extension.tasks.internal.RemoteCommand;
import org.dant.ant.extension.tasks.internal.RemoteResponse;
import org.dant.ant.extension.tasks.internal.Endpoint;

public class LocalHelper implements RemoteHelper {

  protected Dispatcher dispatcher = new DefaultDispatcher();
  
  public RemoteResponse invoke(Endpoint destHost, RemoteCommand rCmd) throws Exception {
    System.out.println("Command <" + rCmd.getName() + "> send to [" + destHost + "] will execute locally");
    RemoteResponse response = new RemoteResponse();
    response.setFullURL(destHost.getFullURL());
    dispatcher.dispatch(rCmd, response);
    return response;
  }

  public String getProtocol() {
    return NetConstants.LOCAL_PROTOCOL;
  }

  public String getPath() {
    return NetConstants.DEFAULT_PATH;
  }
  
}
